package lol

import (
	"github.com/GoAdminGroup/go-admin/context"
	"github.com/GoAdminGroup/go-admin/modules/db"
	"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
	"github.com/GoAdminGroup/go-admin/template/types/form"
)

func GetLolHeroArchivingTable(ctx *context.Context) table.Table {

	lolHeroArchiving := table.NewDefaultTable(table.DefaultConfigWithDriver("sqlite"))

	info := lolHeroArchiving.GetInfo().HideFilterArea()

	info.AddField("Id", "id", db.Int).
		FieldSortable().
		FieldEditAble()
	info.AddField("父值id", "pid", db.Int).
		FieldFilterable().
		FieldSortable().
		FieldEditAble()
	info.AddField("标题", "title", db.Varchar).
		FieldFilterable().
		FieldEditAble()
	info.AddField("关联值", "is_value", db.Int).
		FieldFilterable().
		FieldSortable().
		FieldEditAble()

	info.SetTable("lol_hero_archiving").SetTitle("归档").SetDescription("LolHeroArchiving")

	formList := lolHeroArchiving.GetForm()
	formList.AddField("Id", "id", db.Int, form.Number).
		FieldDefault("0")
	formList.AddField("父值id", "pid", db.Int, form.Number).
		FieldDefault("0")
	formList.AddField("标题", "title", db.Varchar, form.Text)
	formList.AddField("关联值", "is_value", db.Int, form.Number).
		FieldDefault("0")

	formList.SetTable("lol_hero_archiving").SetTitle("归档").SetDescription("LolHeroArchiving")

	return lolHeroArchiving
}
